home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2000 #4 / Amiga Plus CD - 2000 - No. 4.iso / Tools / Musik / Conv / Lame / API next >
Encoding:
Text File  |  2000-04-17  |  2.3 KB  |  69 lines

  1. The LAME API
  2.  
  3. This is the simple interface to the lightweight encoding library
  4. obtained by compiling libmp3lame.a without defining any of
  5. the following extra features:
  6.  
  7. #define HAVEMPGLIB   to use mpglib's mp3 *decoding* capibility
  8. #define AMIGA_MPEGA  to use mpega.library (Amiga), don't use with HAVEMPGLIB
  9. #define BRHIST       to allow the display of the VBR historgram
  10. #define LIBSNDFILE   to use Erik de Castro Lopo's libsndfile
  11. #define LAMESNDFILE  to use LAME's minimial internal sndfile I/O
  12. #define LAMEPARSE    to use LAME's command line parsing/option setting routines
  13.  
  14.  
  15. To use any of the above features, see lame.h more for details.
  16. For an example of a simple command line interface to lame, see
  17. main.c
  18.  
  19.  
  20. =========================================================================
  21.  
  22. 1. (optional) Get the version number of the encoder, if you are interested.  
  23.    lame_version(char *);
  24.  
  25. 2. Initialize the encoder.  sets default for all encoder parameters,
  26. returns pointer to encoder parameters listed above 
  27.  
  28.    #include "lame.h"
  29.    lame_global_flags gf;
  30.    lame_init(%gf);
  31.  
  32. Then override various default settings as necessary, for example:
  33.  
  34.    gf.num_channels=2;
  35.    gf.in_samplerate = 44100;
  36.    gf.brate = 128;
  37.    gf.mode = 0,1 or 3      /* stereo, jstereo, mono */
  38.    gf.quality = 2,5 or 9       /* 2=high, 5=medium 9=low */
  39.  
  40. see lame.h for the complete list of options.
  41.  
  42.  
  43. 3. sets more internal configuration based on data provided above:
  44.    lame_init_params(&gf);
  45.  
  46.  
  47.  
  48. 4. Encode some data.  input pcm data, output (maybe) mp3 frames.
  49. This routine handles all buffering, resampling and filtering for you.
  50. The required mp3buffer_size can be computed from num_samples, 
  51. samplerate and encoding rate, but here is a worst case estimate:
  52. mp3buffer_size (in bytes) = 1.25*num_samples + 7200
  53. The return code = number of bytes output in mp3buffer.  This can be 0.
  54. If it is <0, an error occured.  
  55.  
  56.    int lame_encode_buffer(lame_global_flags *gfp,
  57.          short int leftpcm[], short int rightpcm[],
  58.          int num_samples,char *mp3buffer,int  mp3buffer_size);
  59.  
  60.  
  61. 5. lame_encode_finish will flush the buffers and may return a 
  62. final few mp3 frames.  mp3buffer should be at least 7200 bytes.
  63. return code = number of bytes output to mp3buffer.  This can be 0.
  64.  
  65.    int lame_encode_finish(lame_global_flags *gfp,char *mp3buffer);
  66.  
  67.  
  68.  
  69.